<?php

class user_model extends FlexiGrid_Model {

    function __construct()
    {
        parent::__construct();
        
    }
    function loginCommercial($e,$p){
        $where=array(
            "Email"=>$e,
            "Password"=>md5($p)
        );
        $query=$this->db
                ->where($where)
                ->get('tbl_commercial'); 
        return $query->result();
    }
    function loginPersonal($e,$p){
        $where=array(
            "Email"=>$e,
            "Password"=>md5($p)
        );
        $query=$this->db
                ->where($where)
                ->get('tbl_personal'); 
        return $query->result();
    }
    function insertCommercial($params){
        $this->db->set('Insert', 'NOW()', FALSE);
        $this->db->insert('tbl_commercial', $params); 
        $count = $this->db->affected_rows(); //should return the number of rows affected by the last query
        if($count==1) return true;
        return false;
    }
    function insertPersonal($params){
        $this->db->set('Insert', 'NOW()', FALSE);
        $this->db->insert('tbl_personal', $params); 
        $count = $this->db->affected_rows(); //should return the number of rows affected by the last query
        if($count==1) return true;
        return false;
    }
}
?>
